import { createRouter, createWebHistory } from 'vue-router'
const login = () => import('@/views/login')
const Layout = () => import('@/views/layout')
const Home = () => import('@/views/home')
const TopCategory = () => import('@/views/category')
const SubCategory = () => import('@/views/category/sub.vue')
const DetailData = () => import('@/views/category/DetailData.vue')
const xiangqin = () => import('@/views/category/xiangqin.vue')
const ce = () => import('@/library/ceshi')
const pay = () => import('../views/layout/components/cart/pay')
const cart = () => import('../views/layout/components/top-header-cart')
const routes = [{
  path: '/',
  component: Layout,
  children: [
    { path: '/', component: Home },
    {
      path: '/category:id',
      component: TopCategory
    },
    { path: '/category/sub:id', component: SubCategory },
    {
      path: '/category/DetailData:id',

      name: 'Data',
      component: DetailData
    },
    {
      path: '/category/xiangqin:id',

      name: 'xiangqin',
      component: xiangqin
    },
    {
      path: '/pay',

      name: 'XtxCartPage',
      component: pay
    }

  ]
},
{
  path: '/login',
  component: login
},
{
  path: '/ce',
  component: ce
}, {
  path: '/cart',

  name: 'AppHeader',
  component: cart
}

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
